{include file='public:header-css'/}
<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--左侧导航-->
    {include file='public:left-menu'/}
    <!--End 左侧导航-->
    <!--头部信息-->
    {include file='public:nav-header' title="会员管理" subTitle="会员团队等级"/}
    <!--End 头部信息-->

    <!--页面主要内容-->
    <main class="lyear-layout-content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="hint">
                <div class="hint-info">
                  <h5><i class="mdi mdi-help-circle-outline"></i>操作提示</h5>
                  <p>添加等级后不可删除 请仔细核对信息填写</p>
                </div>
              </div>
              <div class="card-toolbar">
                <div class="toolbar-btn-action">
                  <a class="btn btn-label btn-theme" href="{:url('User/add_edit_td_level')}"><label><i class="mdi mdi-plus-box"></i></label> 添加等级</a>
                </div>
                <div class="card-toolbar-center">
                  <a href="" class="table-btn btn-dark"><i class="mdi mdi-replay"></i></a>
                  <button class="table-btn btn-theme">共{$list->total()}条记录 当前第{$list->currentPage()}页</button>
                </div>
              </div>
              <div class="card-body">
                <div class="table-responsive">
                  <table class="table table-bordered table-striped table-hover">
                    <thead>
                    <tr>
                      <th style="width: 110px">操作</th>
                      <th>等级</th>
                      <th>等级名称</th>
                      <th>业绩要求</th>
                      <th>升级条件</th>
                      <th>级差奖励</th>
                      <th>平级奖励</th>
                      <th>创建时间</th>
                      <th>更新时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    {if $list->isEmpty()}
                    <tr>
                      <td class="no-data" colspan="50">
                        <i class="mdi mdi-alert-decagram"></i>没有符合条件的记录
                      </td>
                    </tr>
                    {else/}
                    {volist name="$list" id="vo"}
                    <tr>
                      <td>
                        <a class="table-btn btn-theme" href="{:url('User/add_edit_td_level',['level_id'=>$vo[$vo.pk]])}"><i class="mdi mdi-pencil"></i>编辑</a>
                      </td>
                      <td>{$vo.level_id}</td>
                      <td>{$vo.name}</td>
                      <td>{$vo.yeji}</td>
                      <td>{$vo.tiao_jian_text}</td>
                      <td>{$vo.jl_bl}%</td>
                      <td>{$vo.pj_bl}%</td>
                      <td>{$vo.add_time}</td>
                      <td>{$vo.update_time}</td>
                    </tr>
                    {/volist}
                    {/if}
                    </tbody>
                  </table>
                </div>
                <!--分页-->
                <div class="page">
                  {$page|raw}
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript">
  $(function(){
    $('.open').on('click', function () {
      if ($(this).hasClass('text-success')) {
        var open = 0;
        var add = 'text-red mdi-close-circle-outline';
        var remove = 'text-success mdi-checkbox-marked-circle-outline';
        var text = ' 否';
      } else {
        var open = 1;
        var add = 'text-success mdi-checkbox-marked-circle-outline';
        var remove = 'text-red mdi-close-circle-outline';
        var text = ' 是';
      }
      var id = $(this).attr('data-id');
      var field = $(this).attr('data-field');
      var obj = $(this);
      changeTableVal('user_level', field, id, open, function (res) {
        if (res.code == 1) {
          obj.removeClass(remove).addClass(add).text(text);
        }
      });
    });
  });
</script>
</body>
</html>